home *** CD-ROM | disk | FTP | other *** search
Wrap
/* $VER: JPEG_+_Comment 1.10 (21.5.95)© Felix C. Coronado */ ADDRESS "ADPro" OPTIONS RESULTS /*Change these values to control the size of the "Searching for comments" window*/ SrchOutWinX=275 SrchOutWinY=90 /*Change these values to control the size of the "Display comments" window*/ ComOutWinX=640 ComOutWinY=198 /*If you are low on memory, you might want to make this smaller, but it should stay in the range of 2 - 65535*/ BlockSize=65535 NL='0A'x SmoothStat='Off' Button='On' DO WHILE rc~=1 ADPRO_TO_FRONT OKAYN '"ADPro JPEG_+_Comment Loader"', '"Smoothing '||SmoothStat'"', "OK|"||Button||"|Cancel" if rc=0 THEN EXIT if rc=2 THEN DO zz=SmoothStat SmoothStat=Button Button=zz end END IF SmoothStat='Off' THEN JPEGOpts='' ELSE JPEGOpts='SMOOTHING' ADPRO_TO_FRONT GETFILE '"Load JPEG File"' IF rc=10 THEN EXIT ELSE DO FullFileName=ADPro_Result zz=LASTPOS('/',FullFileName) IF zz=0 THEN zz=INDEX(FullFileName,':') FileDir=LEFT(FullFileName,zz) FileName=RIGHT(FullFileName,LENGTH(FullFileName)-zz) IF FileDir~='/' & RIGHT(FileDir,2)~='//' & RIGHT(FileDir,1)='/' THEN FileDir=LEFT(FileDir,LENGTH(FileDir)-1) IF OPEN(File,FullFileName,R) THEN DO IF READCH(File,4)='FFD8FFE0'x & RIGHT(READCH(File,6),4)='JFIF' THEN DO SET_ADPRO_PUBLIC ADProScrn=adpro_result SET_ADPRO_MODE ScreenWidth=WORD(ADPRO_RESULT,2) ScreenHeight=WORD(ADPRO_RESULT,3) IF OPEN(CON,'con:'||TRUNC((ScreenWidth-SrchOutWinX)/2)||'/'||TRUNC((ScreenHeight-SrchOutWinY)/2)||'/'||SrchOutWinX||'/'||SrchOutWinY||'/ADPro JPEG_+_Comment Loader/NOSIZE/SCREEN '||ADProScrn,'W') THEN DO Comment='' CALL WRITECH(CON,'1B5B316D'x||'File: '||'1B5B306D'x||FileName||NL||, '1B5B316D'x||'Smoothing: '||'1B5B306D'x||SmoothStat||NL||, NL||, 'Searching for comments...'||NL||, NL||, 'Ctrl-d to stop') SIGNAL ON BREAK_D BlockNum=0 SearchVar='' ComNum=0 StartPos=SEEK(File,10,'C') DO WHILE ~EOF(File) BlockNum=BlockNum+1 SearchVar=RIGHT(SearchVar,1)||READCH(File,BlockSize-1) IF INDEX(SearchVar,'FFFE'x)~=0 THEN DO ComNum=ComNum+1 ComLengthPos=StartPos+(BlockNum-1)*(BlockSize-1)+INDEX(SearchVar,'FFFE'x) CALL SEEK(File,ComLengthPos,'B') ComLength=C2D(READCH(File,2))-2 Comment=Comment||NL||, NL||, '1B5B316D'x||'Comment '||ComNum||':'||'1B5B306D'x||NL||, STRIP(COMPRESS(READCH(File,ComLength),'0D'x),'B','0A'x) BlockNum=0 SearchVar='' StartPos=SEEK(File,0,'C') END END SIGNAL OFF BREAK_D END END ELSE DO ADPRO_TO_FRONT OKAY1 'Error During Load'||NL||, 'Not A JPEG File' EXIT END END ELSE DO ADPRO_TO_FRONT OKAY1 'Error opening file'||NL||, '"'||FullFileName||'"' EXIT END END BREAK_D: SearchVar='' CALL CLOSE(File) CALL CLOSE(CON) IF Comment~='' THEN DO ADPRO_TO_FRONT IF OPEN(CON,'con:'||TRUNC((ScreenWidth-ComOutWinX)/2)||'/'||TRUNC((ScreenHeight-ComOutWinY)/2)||'/'||ComOutWinX||'/'||ComOutWinY||'/ADPro JPEG_+_Comment Loader/CLOSE/WAIT/SCREEN '||ADProScrn,'W') THEN DO CALL WRITECH(CON,'1B5B316D'x||'File: '||'1B5B306D'x||FullFileName||NL||, '1B5B316D'x||'Smoothing: '||'1B5B306D'x||SmoothStat||, Comment) CALL CLOSE(CON) END END LFORMAT 'JPEG' IF rc=10 THEN DO ADPRO_TO_FRONT OKAY1 'Error: Loader not found'||NL||, '"Loaders2/JPEG"' EXIT END LOAD '"'FullFileName'"' JPEGOpts IF rc=10 THEN DO ADPRO_TO_FRONT OKAY1 'Error loading file'||NL||, '"'||FullFileName||'"' END LFORMAT 'JPEG_+_Comment'